package com.yycx.msg.client.enums;


import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yycx.common.enums.OnLineEnum;

/**
 * 消息类型
 *
 * @author zyf
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum MsgTypeEnum {
    /**
     * 系统消息
     */
    SysMsg("sysMsg", 1),

    /**
     * 个人消息
     */
    PersonMsg("personMsg", 2),

    /**
     * 推送消息
     */
    PushMsg("personMsg", 3);


    MsgTypeEnum(String code, Integer value) {
        this.code = code;
        this.value = value;
    }

    @EnumValue
    private final String code;
    private final Integer value;

    public String getCode() {
        return code;
    }

    public Integer getValue() {
        return value;
    }

    public static Integer getValue(String code) {
        Integer v = null;
        for (MsgTypeEnum msgTypeEnum : MsgTypeEnum.values()) {
            if (msgTypeEnum.getCode() == code) {
                v = msgTypeEnum.getValue();
                break;
            }
        }
        return v;
    }
}

